
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        Integer[] a = new Integer[3*n];
        for (int i = 0; i < a.length; i++) {
            a[i] = in.nextInt();
        }
         Arrays.sort(a, new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2-o1;
            }
        });
        System.out.println(Arrays.toString(a));
        long sum = 0;
        for (int i = 1; i <= n; i++) {
            sum += a[2*(i-1)+1];
        }
        System.out.println(sum);
    }
}